package com.xiangban.yanglaodajie_admin.controller;

import com.xiangban.yanglaodajie_admin.aop.Permission;
import com.xiangban.yanglaodajie_admin.entity.res.ApiResult;
import com.xiangban.yanglaodajie_admin.service.OrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/6/18 9:25
 */
@RestController
@RequestMapping("/api/admin/orders")
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    @PostMapping("/oneWeekOrdersPrice")
    @ApiOperation("首页折线图")
    @Permission(permission = "admin:orders:oneWeekOrdersPrice")
    public ApiResult<Object> oneWeekOrdersPrice(){

        return ApiResult.newSuccess(ordersService.oneWeekOrdersPrice());
    }

    @PostMapping("/homePage")
    @ApiOperation("首页销售数据")
    @Permission(permission = "admin:orders:homePage")
    public ApiResult<Object> homePage(){

        return ApiResult.newSuccess(ordersService.homePage());
    }

}
